package com.yq.light.note.code.service.impl;

import com.yq.light.commons.code.entity.Note;
import com.yq.light.note.code.dao.NoteDao;
import com.yq.light.note.code.service.NoteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("noteService")
@Transactional
@Slf4j
public class NoteServiceImpl implements NoteService {

    @Autowired
    private NoteDao noteDao;

    /**
     * insert新笔记
     *
     * @param note
     * @return
     */
    @Override
    public int newNote(Note note) {
        int result = 0;
        result = noteDao.newNote(note);
        return result;
    }

    /**
     * select笔记列表
     *
     * @param ownerAccount
     * @return
     */
    @Override
    public List<Note> fetchNoteList(String ownerAccount) {
        List<Note> list = noteDao.fetchNoteList(ownerAccount);
        return list;
    }
}
